import { Controller, Get, Post, Body, Patch, Param, Delete, UseInterceptors } from '@nestjs/common';
import { UsersService } from './users.service';
import { CreateUserDto } from './dto/create-user.dto';
import { UpdateUserDto } from './dto/update-user.dto';
import { UserId } from '../decorators/user.decorator';
import { TransformDateInterceptor } from '../interceptors/transform-date.interceptor';
import { updateAccountDto } from './dto/update-account.dto';

@UseInterceptors(TransformDateInterceptor)
@Controller('users')
export class UsersController {
  constructor(private readonly usersService: UsersService) {}


  @Post()
  update(@UserId() userId: number, @Body() updateUserDto: UpdateUserDto) {
    return this.usersService.update(userId, updateUserDto);
  }

  @Get()
  findOne(@UserId() userId: number) {
    return this.usersService.findOne(userId);
  }
  
  @Post('account')
  accountSet(@UserId() userId: number, @Body() updateAccountDto: updateAccountDto) {
    return this.usersService.accountSet(userId, updateAccountDto);
  }
}
